package com.authine.cloudpivot.web.api.secondopen.service.impl;

import com.authine.cloudpivot.web.api.secondopen.dao.ReportMapper;
import com.authine.cloudpivot.web.api.secondopen.modules.ReportVO;
import com.authine.cloudpivot.web.api.secondopen.service.ReportService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ReportServiceImpl  implements ReportService {

    @Autowired
    private ReportMapper reportMapper;

    @Override
    public List<ReportVO> getItReport() {
        Map<String, Long> itReportmap =reportMapper.getItReport();

        ReportVO erpvo = new ReportVO();
        erpvo.setName("ERP权限申请");
        erpvo.setTotal(itReportmap.get("erptotal"));
        erpvo.setComplete(itReportmap.get("erpcomplete"));

        ReportVO jsjqxvo = new ReportVO();
        jsjqxvo.setName("计算机权限申请");
        jsjqxvo.setTotal(itReportmap.get("jsjqxtotal"));
        jsjqxvo.setComplete(itReportmap.get("jsjqxcomplete"));

        ReportVO jsjyjvo = new ReportVO();
        jsjyjvo.setName("计算机硬件申请");
        jsjyjvo.setTotal(itReportmap.get("jsjyjtotal"));
        jsjyjvo.setComplete(itReportmap.get("jsjyjcomplete"));

        ReportVO lkwwvo = new ReportVO();
        lkwwvo.setName("来客外网申请");
        lkwwvo.setTotal(itReportmap.get("lkwwtotal"));
        lkwwvo.setComplete(itReportmap.get("lkwwcomplete"));

        ReportVO jsjrjkf = new ReportVO();
        jsjrjkf.setName("计算机软件开发变更");
        jsjrjkf.setTotal(itReportmap.get("jsjrjkftotal"));
        jsjrjkf.setComplete(itReportmap.get("jsjrjkfcomplete"));

        List<ReportVO> reportVOS=new ArrayList<>();
        reportVOS.add(erpvo);
        reportVOS.add(jsjqxvo);
        reportVOS.add(jsjyjvo);
        reportVOS.add(lkwwvo);
        reportVOS.add(jsjrjkf);
        return reportVOS;
    }
}
